package charpter06;

/**
 * Created by Miracle yaochengwei on 2022/5/18 21:50
 */
public class Homework01 {
    public static void main(String[] args) {
        //1.编程实现如下功能Homework01 java
        //先自己做，再听老师评讲，这样学习有效果.
        //某人有100,000元,每经过一次路口，需要交费，规则如下:
        //1)当现金> 50000时，每次交5%
        //2)当现金< = 50000时,每次交1000
        //编程计算该人
       double money = 100000; //剩余钱
       int count = 0;//累积过路口
       while(true){//无线循环
           if (money > 50000){
               //money = money -  money * 0.05;
               money *= 0.95; //money = money *0.95
               count++;
           }else if (money >=1000){
               money -= 1000;
               count++;
           }else{//钱不够
               break;
           }
       }
        System.out.println("100000可以过"+count +"路口");
    }
}
